Type.registerNamespace("Telerik.Web.UI.Scheduler.Views.Month");
(function(c,d,e,f){var h=60000;
var a=h*60;
var g=a*24;
var b=g*7;
f.ModelBase=function(i){this._owner=i;
this._settings=this._owner.get_monthViewSettings();
};
f.ModelBase.prototype={get_visibleRangeStart:function(){var k=this._owner.get_selectedDate();
var j=e.DateHelper.getFirstDayOfMonth(k);
var l=e.DateHelper.getStartOfWeek(j,this._owner.get_firstDayOfWeek());
var m=e.DateHelper.getEndOfWeek(l,this._owner.get_firstDayOfWeek(),this.get_weekLength());
var i;
if(m.getMonth()==k.getMonth()){i=l;
}else{i=e.DateTime.add(l,7*g);
}return i;
},get_visibleRangeEnd:function(){var i=e.DateHelper.getLastDayOfMonth(this._owner.get_selectedDate());
return e.DateHelper.getEndOfWeek(i,this._owner.get_firstDayOfWeek(),this.get_weekLength());
},get_nextPeriodDate:function(){var i=this._owner.get_selectedDate();
return new Date(i.getFullYear(),i.getMonth(),32);
},get_previousPeriodDate:function(){var i=this._owner.get_selectedDate();
return new Date(i.getFullYear(),i.getMonth(),0);
},get_weekLength:function(){return e.DateHelper.getWeekLength(this._owner.get_selectedDate(),this._owner.get_firstDayOfWeek(),this._owner.get_lastDayOfWeek());
},get_headerDateFormat:function(){return this._settings.headerDateFormat||"MMM, yyyy";
},get_dayHeaderDateFormat:function(){return this._settings.dayHeaderDateFormat||"dd";
},get_firstDayHeaderDateFormat:function(){return this._settings.firstDayHeaderDateFormat||"dd MMM";
},get_visibleAppointmentsPerDay:function(){return this._settings.visibleAppointmentsPerDay||2;
},getDurationOfMovedAppointment:function(i){return i.get_duration();
},_getTimeSlotIndices:function(i){var l=e.DateTime.subtract(i,this.get_visibleRangeStart());
var m=Math.floor(l/b);
var j=l-(m*b);
var k=Math.floor(j/g);
return{dayIndex:(this.get_weekLength()*m)+k};
},isVisible:function(i){return i._isInRange(this.get_visibleRangeStart(),this.get_visibleRangeEnd());
}};
f.ModelBase.registerClass("Telerik.Web.UI.Scheduler.Views.Month.ModelBase");
f.Model=function(i){if(e.Rendering.HorizontalBlockCollection){this._allDayBlocks=new e.Rendering.HorizontalBlockCollection();
}f.Model.initializeBase(this,[i]);
};
f.Model.prototype={initialize:function(){},addToBlocks:function(i){this._allDayBlocks.add(i);
},removeFromBlock:function(i){this._allDayBlocks.remove(i);
},getTimeSlotFromDomElement:function(k){var j=this._getRawIndexFromDomElement(k);
var i=this._getTimeFromDomElement(k);
return new f.TimeSlot(j,i,k);
},_getTimeFromDomElement:function(i){var j=this._getRawIndexFromDomElement(i);
return this._getTimeFromIndex(j);
},_getTimeFromIndex:function(n){var m=this.get_visibleRangeStart();
var j=this.get_weekLength();
var i=Math.floor(n.dayIndex/j);
var k=n.dayIndex%j;
var l=(i*7)+k;
d.RadScheduler._incrementTime(m,24*l,0);
return m;
},_getRawIndexFromDomElement:function(k){while(k&&(k.tagName.toUpperCase()!="TD")){k=k.parentNode;
}if(k){var i=k.parentNode;
var l=i.cells.length;
var m=k.cellIndex;
var j=i.rowIndex;
return{dayIndex:(l*j)+m};
}return null;
},getTimeSlotForAppointment:function(i){return this._getAllDayTimeSlotFromStartTime(i.get_start());
},_getAllDayTimeSlotForAppointmentPart:function(i){return this._getAllDayTimeSlotFromStartTime(i.start);
},_getAllDayTimeSlotFromStartTime:function(i){var j=this._getTimeSlotIndices(i);
var k=this._getTimeSlotDomElement(j);
return new f.TimeSlot(j,null,k);
},_getTimeSlotDomElement:function(i){var j=this._owner.get_element();
var k=Math.floor(i.dayIndex/this.get_weekLength());
var l=Math.floor(i.dayIndex%this.get_weekLength());
return c("div.rsTopWrap table.rsContentTable",j)[0].tBodies[0].rows[k].cells[l];
},_getRenderer:function(){if(!this._renderer){this._renderer=new d.Scheduler.Rendering.MonthViewRenderer(this);
}return this._renderer;
}};
f.Model.registerClass("Telerik.Web.UI.Scheduler.Views.Month.Model",f.ModelBase);
f.TimeSlot=function(j,i,k){this._rawIndex=j;
this._startTime=i;
this._domElement=k;
};
f.TimeSlot.prototype={get_index:function(){var i=this.get_rawIndex();
return String.format("{0}",i.dayIndex);
},get_rawIndex:function(){return this._rawIndex;
},get_startTime:function(){return this._startTime;
},get_endTime:function(){return e.DateTime.add(this.get_startTime(),this.get_duration());
},get_duration:function(){return this.get_durationInMinutes()*h;
},get_durationInMinutes:function(){return 1440;
},get_isAllDay:function(){return true;
},get_domElement:function(){return this._domElement;
}};
f.TimeSlot.registerClass("Telerik.Web.UI.Scheduler.Views.Month.TimeSlot",null,d.ISchedulerTimeSlot);
})($telerik.$,Telerik.Web.UI,Telerik.Web.UI.Scheduler,Telerik.Web.UI.Scheduler.Views.Month);
